import { nextTick, ref } from 'vue';
import { Input, message } from 'ant-design-vue';
import { useAuthStore } from '@/store/modules/auth';
import { isNonNegativeInteger } from '@/utils';
import { post } from '@/service/api/api';
import DownloadOutputStatement from '../../modal/download-output-statement.vue';

let topFormModel;
let bottomFormModel;
const moduleNoSearchData = ref(null);
const authStore = useAuthStore();
const machineNumber = ref(null);
const modalVisible = ref(false);

// 获取机台号
function getMachineNumber() {
  post('/mes/jlagv/machine/woker/machineNo').then(({ data, error }) => {
    if (!error) {
      machineNumber.value = data;
      nextTick(() => {
        topFormModel.value.machineNumber = machineNumber.value;
      });
    }
  });
}

export default {
  url: '/qms/agv/ProductionDaily/find',
  addUrl: '/qms/agv/ProductionDaily/add',
  editUrl: '/qms/agv/ProductionDaily/update',
  delUrl: '/qms/agv/ProductionDaily/deleteBatch',
  modalGetTableDataUrl: '/qms/agv/ProductionDaily/',
  downLoadUrl: '/qms/agv/ProductionDaily/exportExcel',
  delMethod: 'put',
  editMethod: 'put',
  otherBtnList: [
    {
      icon: 'icon-ic-round-download ',
      name: '导出产值表',
      iconType: 3,
      auth: 'production-management:7:download-output-statement',
      handleClick() {
        modalVisible.value = true;
      }
    }
  ],
  rednderComponents: [
    () => (
      <DownloadOutputStatement
        visible={modalVisible.value}
        onClose={() => (modalVisible.value = false)}
      ></DownloadOutputStatement>
    )
  ],
  searchFormList: [
    {
      type: 'input',
      key: 'moduleNo',
      label: '生产型号',
      placeholder: '请输入生产型号',
      span: 24,
      md: 12,
      lg: 8,
      xl: 8,
      xxl: 6
    },
    {
      type: 'input',
      key: 'machineNumber',
      label: '机台号',
      placeholder: '请输入机台号',
      span: 24,
      md: 12,
      lg: 8,
      xl: 8,
      xxl: 6
    },
    {
      type: 'input',
      key: 'serialNum',
      label: '单据号',
      placeholder: '请输入单据号',
      span: 24,
      md: 12,
      lg: 8,
      xl: 8,
      xxl: 6
    },
    {
      type: 'select',
      key: 'state',
      label: '审核状态',
      placeholder: '请选择审核状态',
      span: 24,
      md: 12,
      lg: 8,
      xl: 8,
      xxl: 6,
      selectOptions: [
        {
          value: '0',
          label: '待领班审核'
        },
        {
          value: '1',
          label: '待修改'
        },
        {
          value: '2',
          label: '待主管审核'
        },
        {
          value: '3',
          label: '审核完成'
        }
      ]
    },
    {
      type: 'select',
      key: 'dateClass',
      label: '班别',
      placeholder: '请选择班别',
      span: 24,
      md: 12,
      lg: 8,
      xl: 8,
      xxl: 6,
      selectOptions: [
        {
          value: 'A',
          label: 'A班'
        },
        {
          value: 'B',
          label: 'B班'
        }
      ]
    },
    {
      type: 'input',
      key: 'operator',
      label: '操作人',
      placeholder: '请输入操作人',
      span: 24,
      md: 12,
      lg: 8,
      xl: 8,
      xxl: 6
    },
    {
      type: 'dateRangePicker',
      key: 'time',
      label: '时间',
      span: 24,
      md: 12,
      lg: 10,
      xl: 8,
      xxl: 6,
      showTime: true
    }
  ],
  searchParam: ref({
    moduleNo: null,
    dateClass: null,
    operator: null,
    machineNumber: null,
    state: null,
    time: null
  }),
  column: [
    {
      key: 'dataIndex',
      dataIndex: 'dataIndex',
      title: '序号',
      width: 70,
      fixed: 'left',
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'moduleNo',
      dataIndex: 'moduleNo',
      title: '生产型号',
      width: 150,
      align: 'center',
      fixed: 'left',
      checked: true,
      ellipsis: true
    },
    {
      key: 'serialNum',
      dataIndex: 'serialNum',
      title: '单据号',
      width: 130,
      align: 'center',
      fixed: 'left',
      checked: true,
      ellipsis: true
    },
    {
      key: 'date',
      dataIndex: 'date',
      title: '日期',
      width: 180,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'machineNumber',
      dataIndex: 'machineNumber',
      title: '机台号',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'operator',
      dataIndex: 'operator',
      title: '操作员',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'dateClass',
      dataIndex: 'dateClass',
      title: '班别',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'passNumber',
      dataIndex: 'passNumber',
      title: '趟数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'state',
      dataIndex: 'state',
      title: '状态',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true,
      customRender: ({ record }) => {
        return ['待领班审核', '待修改', '待主管审核', '审核完成'][record.state];
      }
    },

    {
      key: 'passPcs',
      dataIndex: 'passPcs',
      title: '每趟片数',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'stackup',
      dataIndex: 'stackup',
      title: '叠层',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'endPass',
      dataIndex: 'endPass',
      title: '尾趟',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'transformations',
      dataIndex: 'transformations',
      title: '转型号次数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'meridional',
      dataIndex: 'meridional',
      title: '尺寸长',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'zonal',
      dataIndex: 'zonal',
      title: '尺寸宽',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'thickness',
      dataIndex: 'thickness',
      title: '板厚',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'diameter',
      dataIndex: 'diameter',
      title: '孔径',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'totalPnlNumber',
      dataIndex: 'totalPnlNumber',
      title: '总PNL数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'axesNumber',
      dataIndex: 'axesNumber',
      title: '轴数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'pholeNumber',
      dataIndex: 'pholeNumber',
      title: 'PNL孔数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'area',
      dataIndex: 'area',
      title: '面积M2',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'totalHoleNumber',
      dataIndex: 'totalHoleNumber',
      title: '总孔数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'price',
      dataIndex: 'price',
      title: '单价',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true,
      customRender: ({ record }) => {
        return Number(record.price).toFixed(2);
      }
    },

    {
      key: 'output',
      dataIndex: 'output',
      title: '产值',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'drillDowns',
      dataIndex: 'drillDowns',
      title: '下钻次数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'totalPass',
      dataIndex: 'totalPass',
      title: '总趟数',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'loadingTime',
      dataIndex: 'loadingTime',
      title: '上下板时间',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'changeProTime',
      dataIndex: 'changeProTime',
      title: '更换料号时间',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'maintenanceTime',
      dataIndex: 'maintenanceTime',
      title: '保养时间',
      width: 120,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'actualUtilizationRate',
      dataIndex: 'actualUtilizationRate',
      title: '实际稼动率(%)',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'weightedUtilizationRate',
      dataIndex: 'weightedUtilizationRate',
      title: '加权稼动率(%)',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'drillInCopper',
      dataIndex: 'drillInCopper',
      title: '内层铜厚',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'drillOutCopper',
      dataIndex: 'drillOutCopper',
      title: '外层铜厚',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'drillTotalCopper',
      dataIndex: 'drillTotalCopper',
      title: '总铜厚',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'tgValue',
      dataIndex: 'tgValue',
      title: 'TG值',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'boardType',
      dataIndex: 'boardType',
      title: '板材类型',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'zvalue',
      dataIndex: 'zvalue',
      title: 'Z值',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'grinderTimes',
      dataIndex: 'grinderTimes',
      title: '研磨次数',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'machineSpeed',
      dataIndex: 'machineSpeed',
      title: '转速S',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'knifeInSpeed',
      dataIndex: 'knifeInSpeed',
      title: '进刀速F',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'returnSpeed',
      dataIndex: 'returnSpeed',
      title: '回速R',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'holeLimit',
      dataIndex: 'holeLimit',
      title: '孔限N',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'perCostTime',
      dataIndex: 'perCostTime',
      title: '每趟钻孔耗时',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'modulePosition',
      dataIndex: 'modulePosition',
      title: '料号生产坐标',
      width: 140,
      align: 'center',
      checked: true,
      ellipsis: true
    },

    {
      key: 'checkNum1',
      dataIndex: 'checkNum1',
      title: '首件检查',
      width: 90,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'checkNum2',
      dataIndex: 'checkNum2',
      title: '自主检查',
      width: 90,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'checkNum3',
      dataIndex: 'checkNum3',
      title: '末件检查',
      width: 90,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'checkResult',
      dataIndex: 'checkResult',
      title: '检查结果',
      width: 90,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'operator',
      dataIndex: 'operator',
      title: '操作员',
      width: 110,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'foreman',
      dataIndex: 'foreman',
      title: '领班审核',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'foremanTime',
      dataIndex: 'foremanTime',
      title: '领班审核时间',
      width: 180,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'examiner',
      dataIndex: 'examiner',
      title: '主管审核',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'examinerTime',
      dataIndex: 'examinerTime',
      title: '主管审核时间',
      width: 180,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'remark',
      dataIndex: 'remark',
      title: '备注',
      width: 180,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'createTime',
      dataIndex: 'createTime',
      title: '创建时间',
      width: 180,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'updateTime',
      dataIndex: 'updateTime',
      title: '修改时间',
      width: 180,
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'updateBy',
      dataIndex: 'updateBy',
      title: '修改人',
      width: 100,
      align: 'center',
      checked: true,
      ellipsis: true
    }
  ],
  scroll: { x: 2500, y: 'auto' },
  topFormList: [
    // 用于获取model
    {
      type: 'getModel',
      hidden: true,
      handle(topModel, personModle) {
        topFormModel = topModel;
        bottomFormModel = personModle;
      }
    },
    {
      type: 'searchInput',
      key: 'lotNo',
      label: 'Lot号',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      disabled: false,
      otherKeyArr: {
        moduleNo: 'moduleNo',
        LotNo: 'lotNo',
        passNumber: 'passNumber',
        passPcs: 'passPcs',
        endPass: 'endPass',
        stackup: 'stackup',
        transformations: 'transformations',
        maintenanceTime: 'maintenanceTime',
        pholeNumber: 'pholeNumber',
        actualUtilizationRate: 'actualUtilizationRate',
        dateClass: 'dateClass',
        machineNumber: 'machineNumber'
      },
      searchValidate() {
        if (!topFormModel.value.lotNo) {
          topFormModel.value.lotNo = '';
        }
        if (!topFormModel.value.moduleNo) {
          topFormModel.value.moduleNo = '';
        }
        if (!topFormModel.value.passNumber) {
          message.error('请输入趟数!');
          return false;
        }
        if (!topFormModel.value.passPcs) {
          message.error('请输入每趟片数!');
          return false;
        }
        if (!topFormModel.value.stackup) {
          message.error('请输入叠层!');
          return false;
        }
        if (!topFormModel.value.maintenanceTime) {
          message.error('请输入保养时间!');
          return false;
        }
        if (!topFormModel.value.endPass) {
          topFormModel.value.endPass = 0;
        }
        if (!topFormModel.value.transformations) {
          topFormModel.value.transformations = 0;
        }

        if (!topFormModel.value.dateClass) {
          message.error('请选择班别!');
          return false;
        }
        return true;
      },
      transfromSearch(model, searchData) {
        topFormModel = model;
        moduleNoSearchData.value = searchData;
        Object.keys(model.value).forEach(item => {
          model.value[item] = searchData[item] || model.value[item];
        });
      }
    },
    {
      type: 'searchInput',
      key: 'moduleNo',
      label: '生产型号',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      disabled: false,
      otherKeyArr: {
        moduleNo: 'moduleNo',
        LotNo: 'lotNo',
        passNumber: 'passNumber',
        passPcs: 'passPcs',
        endPass: 'endPass',
        stackup: 'stackup',
        transformations: 'transformations',
        maintenanceTime: 'maintenanceTime',
        pholeNumber: 'pholeNumber',
        actualUtilizationRate: 'actualUtilizationRate',
        dateClass: 'dateClass',
        machineNumber: 'machineNumber'
      },
      searchValidate() {
        if (!topFormModel.value.lotNo) {
          topFormModel.value.lotNo = '';
        }
        if (!topFormModel.value.moduleNo) {
          topFormModel.value.moduleNo = '';
        }
        if (!topFormModel.value.passNumber) {
          message.error('请输入趟数!');
          return false;
        }
        if (!topFormModel.value.passPcs) {
          message.error('请输入每趟片数!');
          return false;
        }
        if (!topFormModel.value.stackup) {
          message.error('请输入叠层!');
          return false;
        }
        if (!topFormModel.value.maintenanceTime) {
          message.error('请输入保养时间!');
          return false;
        }
        if (!topFormModel.value.endPass) {
          topFormModel.value.endPass = 0;
        }
        if (!topFormModel.value.transformations) {
          topFormModel.value.transformations = 0;
        }

        if (!topFormModel.value.dateClass) {
          message.error('请选择班别!');
          return false;
        }
        return true;
      },
      transfromSearch(model, searchData) {
        topFormModel = model;
        moduleNoSearchData.value = searchData;
        Object.keys(model.value).forEach(item => {
          model.value[item] = searchData[item] || model.value[item];
        });
        model.value.machineNumber = machineNumber.value;
      }
    },
    {
      type: 'input',
      key: 'passNumber',
      label: '趟数',
      rule: {
        required: true,
        message: '请输入趟数',
        trigger: 'change'
      },
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'passPcs',
      label: '每趟片数',
      span: 8,
      rule: {
        required: true,
        message: '请输入每趟片数',
        trigger: 'change'
      },
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'endPass',
      label: '尾趟',
      span: 8,
      defaultValue: 0,
      rule: {
        required: true,
        message: '请输入尾趟',
        trigger: 'change'
      },
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'stackup',
      label: '叠层',
      span: 8,
      rule: {
        required: true,
        message: '请输入叠层',
        trigger: 'change'
      },
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'datePicker',
      key: 'date',
      label: '日期',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      showTime: true
    },

    {
      type: 'input',
      key: 'maintenanceTime',
      label: '保养时间(分钟)',
      span: 8,
      rule: {
        required: true,
        message: '请输入保养时间(分钟)',
        trigger: 'change'
      },
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'transformations',
      label: '转型号次数',
      defaultValue: 0,
      span: 8,
      rule: {
        required: true,
        message: '请输入转型号次数',
        trigger: 'change'
      },
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'radio',
      key: 'dateClass',
      label: '班别',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      rule: {
        required: true,
        message: '请选择班别',
        trigger: 'change'
      },
      selectOptions: [
        {
          label: 'A',
          value: 'A'
        },
        {
          label: 'B',
          value: 'B'
        }
      ]
    },
    {
      type: 'input',
      key: 'pholeNumber',
      label: 'PNL孔数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'meridional',
      label: '尺寸长',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'zonal',
      label: '尺寸宽',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'thickness',
      label: '板厚',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'diameter',
      label: '孔径',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'totalPnlNumber',
      label: '总PNL数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'axesNumber',
      label: '轴数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'drillDowns',
      label: '下钻次数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'area',
      label: '面积M2',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'totalPass',
      label: '总趟数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'loadingTime',
      label: '上下板时间',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'changeProTime',
      label: '更换料号时间',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'machineNumber',
      label: '机台号',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'totalHoleNumber',
      label: '总孔数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'price',
      label: '单价',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'output',
      label: '产值',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'weightedUtilizationRate',
      label: '加权稼动率(%)',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'select',
      key: 'checkType',
      label: '检查类型',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      selectOptions: [
        {
          value: '首件检查',
          label: '首件检查'
        },
        {
          value: '自主检查',
          label: '自主检查'
        },
        {
          value: '末件检查',
          label: '末件检查'
        }
      ]
    },

    {
      type: 'input',
      key: 'checkNum',
      label: '检查数量',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'radio',
      key: 'checkResult',
      label: '检查结果',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      selectOptions: [
        {
          label: 'OK',
          value: 'OK'
        },
        {
          label: 'NG',
          value: 'NG'
        }
      ]
    },
    {
      type: 'input',
      key: 'drillInCopper',
      label: '内层铜厚',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'drillOutCopper',
      label: '外层铜厚',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'drillTotalCopper',
      label: '总铜厚',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'tgValue',
      label: 'TG值',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },

    {
      type: 'input',
      key: 'hasHalogen',
      label: '系统MI无卤素要求',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'radio',
      key: 'boardType',
      label: '板材类型',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      selectOptions: [
        {
          label: '普通板',
          value: '普通板'
        },
        {
          label: '无卤素板',
          value: '无卤素板'
        }
      ]
    },
    {
      type: 'input',
      key: 'zvalue',
      label: 'Z值',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'select',
      key: 'grinderTimes',
      label: '研磨次数',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      selectOptions: [
        {
          label: '0',
          value: '0'
        },
        {
          label: '1',
          value: '1'
        },
        {
          label: '2',
          value: '2'
        },
        {
          label: '3',
          value: '3'
        },
        {
          label: '4',
          value: '4'
        },
        {
          label: '5',
          value: '5'
        },
        {
          label: '6',
          value: '6'
        }
      ]
    },
    {
      type: 'input',
      key: 'machineSpeed',
      label: '转速S',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'knifeInSpeed',
      label: '进刀速F',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'returnSpeed',
      label: '回速R',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'holeLimit',
      label: '孔限N',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'perCostTime',
      label: '每趟钻孔耗时',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'modulePosition',
      label: '料号生产坐标',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'input',
      key: 'actualUtilizationRate',
      label: '实际稼动率(%)',
      span: 8,
      tansfromDisabled(operateType) {
        return operateType === 'look';
      }
    },
    {
      type: 'textarea',
      key: 'remark',
      label: '备注',
      tansfromDisabled(operateType) {
        return operateType === 'look';
      },
      textareaRows: 1,
      span: 24
    }
  ],
  bottomList: [
    {
      type: 'input',
      key: 'operator',
      label: '操作员',
      defaultValue: authStore.userInfo.user.nickName || authStore.userInfo.user.userName,
      disabled: true,
      span: 8
    },
    {
      type: 'input',
      key: 'foreman',
      label: '领班审核',
      disabled: true,
      span: 8
    },
    {
      type: 'input',
      key: 'examiner',
      label: '主管审核',
      disabled: true,
      span: 8
    }
  ],
  modalHeight: '80vh',
  modalTableKey: 'badId',
  modalAddTableKey: 'badDoList',

  modalTableColumn: [
    {
      key: 'index',
      dataIndex: 'index',
      title: '序号',
      width: 70,
      fixed: 'left',
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'badName',
      dataIndex: 'badName',
      title: '检验项目',
      align: 'center',
      checked: true,
      ellipsis: true
    },
    {
      key: 'number',
      dataIndex: 'number',
      title: '缺陷数量',
      align: 'center',
      checked: true,
      ellipsis: true,
      customRender: ({ record }) => {
        if (record.disabled) {
          return <div style="min-width:150px">{record.number}</div>;
        }
        return (
          <Input
            style="height: 22px !important;"
            value={record.number}
            onBlur={e => {
              const value = e.target.value;
              if (!(isNonNegativeInteger(Number(value).toString()) && Number(value >= 0))) {
                message.error('请输入正整数');
                record.number = null;
                return;
              }
              record.number = Number(value);
            }}
          ></Input>
        );
      }
    }
  ],
  modleSearchUrlObj: {
    lotNo: '/qms/agv/ProductionDaily/findByLotNo',
    moduleNo: '/qms/agv/ProductionDaily/findByLotNo'
  },
  modalGetTableUrlSuffix: {
    add: 'selectBadId',
    byId: 'listBad'
  },
  modalClose() {
    moduleNoSearchData.value = null;
  },
  openModal(val) {
    if (val.operateType === 'add') {
      getMachineNumber();
    }
  }
};
